import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;

Vue.use(Router);

/* Layout */
import Layout from '../views/layout/Layout'
import Layoutoutside from './../views/layoutoutside/Layoutoutside'
import customerProfile from '../views/customerProfile.vue'
import customerQuery from '../views/InfoRetrieval/CustomerProfile/customerProfile.vue'
// import machineQuery from '../views/machineQuery.vue'
// 新改版 设备详情
import machineQuery from '../views/InfoRetrieval/ProductRetrieval/productRetrieval.vue'
// import filter from '../views/filter.vue'
import filter from '../views/InfoRetrieval/AdvancedSearch/advancedSearch.vue'
import statusUpdateFilter from '../views/DataTools/StatusUpdateFilter.vue'
import survey from '../views/deepInsight/survey'
import testW from '../views/Depthanalysis/Activation'
import menuLayout from '../views/Depthanalysis/menuLayout/menuLayout'
import Bidding from '../views/bidding/bidding'
import MyCollection from '../views/bidding/myCollection'
// import CompanyDetails from '../views/deepInsight/CompanyDetails'

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    role: ['admin','editor']     will control the page role (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if fasle ,the page will no be cached(default is false)
  }
 **/
export const constantRouterMap = [
  {path: '/login', component: _import('login/index1'), hidden: true},
  {path: '/authredirect', component: _import('login/authredirect'), hidden: true},
  {path: '/404', component: _import('errorPage/404'), hidden: true},
  {path: '/faq', component: _import('functional/faq'), hidden: true},
  {path: '/guide', component: _import('numberpage/QuanX'), hidden: true},
  // {path: '/CBIAPI', component: _import('CBIAPI/APIAccessProcess'), hidden: true},
  {path: '/aboutus', component: _import('numberpage/newAboutUs'), hidden: true},
  // {path: '/aboutus', component: _import('numberpage/aboutus44'), hidden: true},
  // {path: '/menuLayout', component: _import('menuLayout/menuLayout'), hidden: true},
  // {path: '/menuLayout', component: _import('deepInsight/loyaltyAnalysis'), hidden: true},
  {path: '/gdemo', component: _import('Gdemo'), hidden: true},
  {path: '/item', component: _import('newCustomerInfo'), hidden: true},
  {
    path: '/FAQ',
    component: Layout,
    redirect: '/FAQ/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('functional/faqInside'),
      name: 'FAQ'
    }]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/Homepage',
    // menuLevel: 1,
    meta: {title: 'Homepage', icon: 'icon-zonglan'},
    hidden: true,
  },
  {
    path: '/Homepage',
    component: Layout,
    redirect: '/Homepage/index',
    menuLevel: 1,
    meta: {},
    children: [{
      path: 'index',
      // component: _import('deepInsight/Searchlight'),
      // component: _import('deepInsight/Homepage1'),
      component: _import('Homepage/newHomePage'),
      name: 'Homepage',
      meta: {
        title: 'Homepage',
        icon: 'icon-homepage-icon',
        noCache: true
      }
    }]
  },
  // {
  //   path: '/OverviewIntroduction',
  //   component: Layout,
  //   redirect: '/OverviewIntroduction/index',
  //   hidden: true,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('Introduction/OverviewIntroduction'),
  //     name: 'OverviewIntroduction',
  //     meta: {
  //       title: 'OverviewIntroduction'
  //     }
  //   }]
  // },
  {
    path: '/InfoRetrievalIntroduction',
    component: Layout,
    redirect: '/InfoRetrievalIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      // 新版页面info retrieval
      // component: _import('Introduction/CustomerProfileIntroduction'),
      component: _import('FunctionIntroductionPage/InfoRetrieval'),
      name: 'InfoRetrievalIntroduction',
      meta: {
        title: 'InfoRetrievalIntroduction',
      }
    }]
  },
  {
    path: '/CustomerInsightIntroduction',
    component: Layout,
    redirect: '/CustomerInsightIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('FunctionIntroductionPage/CustomerManagement'),
      name: 'CustomerInsightIntroduction',
      meta: {
        title: 'CustomerInsight'
      }
    }]
  },
  {
    path: '/BusinessInsightIntroduction',
    component: Layout,
    redirect: '/BusinessInsightIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('FunctionIntroductionPage/BusinessInsight'),
      name: 'BusinessInsightIntroduction',
      meta: {
        title: 'BusinessInsightIntroduction'
      }
    }]
  },
  {
    path: '/DataToolsIntroduction',
    component: Layout,
    redirect: '/DataToolsIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      // 新版页面info retrieval
      // component: _import('Introduction/CustomerProfileIntroduction'),
      component: _import('FunctionIntroductionPage/DataTools'),
      name: 'DataToolsIntroduction',
      meta: {
        title: 'DataToolsIntroduction',
      }
    }]
  },
  {
    path: '/DataInfoIntroduction',
    component: Layout,
    redirect: '/DataInfoIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('FunctionIntroductionPage/DataInfo'),
      name: 'DataInfoIntroduction',
      meta: {
        title: 'DataInfoIntroduction'
      }
    }]
  },

  // {
  //   path: '/newSearchResult',
  //   component: Layout,
  //   redirect: '/newSearchResult/index',
  //   hidden: true,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('newSearchResult'),
  //     name: 'newSearchResult',
  //     meta: {
  //       title: 'newSearchResult',
  //       icon: 'lock'
  //     }
  //   }]
  // },
  // {
  //   path: '/SearchResult2',
  //   component: Layout,
  //   redirect: '/SearchResult2/index',
  //   hidden: true,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('searchResult2'),
  //     name: 'SearchResult2',
  //     meta: {
  //       title: 'SearchResult2',
  //       icon: 'lock'
  //     }
  //   }]
  // },
  // {
  //   path: '/filter',
  //   component: Layout,
  //   redirect: '/filter/index',
  //   hidden: true,
  //   children: [{
  //     path: 'index',
  //     component: _import('filter'),
  //     name: 'filter',
  //     meta: {title: 'filter', icon: 'documentation', noCache: true}
  //   }]
  // },
  // {
  //   path: '/filterResult',
  //   component: Layout,
  //   redirect: '/filterResult/index',
  //   hidden: true,
  //   children: [{
  //     path: 'index',
  //     component: _import('filterResult'),
  //     name: 'filterResult',
  //     meta: {title: 'filterResult', icon: 'documentation', noCache: true}
  //   }]
  // }
]

export default new Router({
  // mode: 'history', //后端支持可开
  // scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  {
    path: '/Dashboard',
    component: Layout,
    redirect: '/Dashboard/index',
    menuLevel: 1,
    // meta: {title: 'Overview', icon: 'icon-zonglan'},
    // meta: {title: 'Overview', icon: 'icon-zonglan'},
    meta: {},
    children: [{
      path: 'index',
      // component: _import('overview/overview'),
      // component: _import('overview/newOverView'),
      component: _import('Dashboard1/newOverView'),
      name: 'Overview',
      meta: {
        title: 'Dashboard',
        icon: 'icon-zonglan',
        noCache: true
      }
    }]
  },
  {
    path: '/CustomerProfile',
    // path:'/DataTools',
    component: Layout,
    // redirect: '/CustomerProfile/CustomerProfile',
    // menuLevel: 1,
    meta: {title: 'InfoRetrieval', icon: 'icon-yonghuming'},
    children: [
      {
        path: 'CustomerProfile',
        component: customerQuery,
        name: 'CustomerProfile',
        hidden: false,
        meta: {
          title: 'CustomerProfile'
        }
      },
      {
        path: 'ProductRetrieval',
        component: machineQuery,
        name: 'ProductRetrieval',
        hidden: false,
        meta: {
          title: 'ProductRetrieval'
        }
      },
      {
        path: 'AdvancedSearch',
        component: filter,
        name: 'AdvancedSearch',
        hidden: false,
        meta: {
          title: 'AdvancedSearch'
        }
      },
      {
        path: 'newSearchResult',
        component: _import('newSearchResult/newSearchResult'),
        name: 'newSearchResult',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'newSearchResult',
          icon: 'icon-information'
        }
      },
      {
        path: 'companyDetails',
        component: _import('Depthanalysis/CompanyDetails'),
        name: 'companyDetails',
        noFilter: true,
        hidden: true,
      },
      {
        path: 'SearchResult2',
        component: _import('searchResult2'),
        name: 'SearchResult2',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'SearchResult2',
          icon: 'icon-information'
        }
      },
      {
        path: 'filterResult',
        component: _import('filterResult'),
        name: 'filterResult',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'filterResult',
          icon: 'icon-information'
        }
      },
      {
        path: 'filterResultCBD',
        component: _import('filterResultCBD'),
        name: 'filterResultCBD',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'filterResultCBD',
          icon: 'icon-information'
        }
      },
      {
        path: 'filterResultMachine',
        component: _import('filterResultMachine'),
        name: 'filterResultMachine',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'filterResultMachine',
          icon: 'icon-information'
        }
      },
      {
        path: 'ProductDetails',
        component: _import('Depthanalysis/ProductDetails'),
        name: 'ProductDetails',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'ProductDetails'
        }
      },
    ]
  },

  {
    path: '/CustomerInsight',
    component: Layout,
    noFilter: true,
    meta: {
      title: 'CustomerInsight',
      icon: 'icon-CustomerInsight',
      role: ['admin']
    },
    children: [
      {
        path: 'CustomerLoyalty',
        component: _import('customerInsight/LoyaltyAnalysis'),
        name: 'CustomerLoyalty',
        hidden: false,
        meta: {
          title: 'CustomerLoyalty'
        }
      },
      {
        path: 'CustomerContribution',
        component: _import('customerInsight/CustomerContribution'),
        name: 'CustomerContribution',
        hidden: false,
        meta: {
          title: 'CustomerContribution'
        }
      },
      {
        path: 'CustomerRanking',
        // component: _import('Depthanalysis/CustomerRanking'),
        component: _import('customerInsight/customerRanking'),
        name: 'CustomerRanking',
        hidden: false,
        meta: {
          title: 'CustomerRanking'
        }
      },
      {
        path: 'TopCustomer',
        component: _import('customerInsight/TopCustomer'),
        name: 'TopCustomer',
        hidden: false,
        meta: {
          title: 'TopCustomer'
        }
      },
      {
        path: 'CustomerSurvey',
        component: _import('customerInsight/CustomerSurvey'),
        name: 'CustomerSurvey',
        hidden: false,
        meta: {
          title: 'CustomerSurvey'
        }
      }
    ]
  },
  {
    path: '/BusinessInsight',
    component: Layout,
    noFilter: true,
    meta: {title: 'BusinessInsight', icon: 'icon-BusinessInsight-ico', role: ['admin']},
    children: [
      {
        path: 'BidOpportunity',
        component: Bidding,
        name: 'AdvancedSearch',
        noFilter: true,
        hidden: false,
        meta: {
          title: 'BidOpportunity'
        }
      },
      {
        path: 'myCollection',
        component: MyCollection,
        name: 'AdvancedSearch',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'myCollection'
        }
      },
      {
        path: 'ProductConfiguration',
        component: _import('BusinessInsight/ProductConfiguration/Configguration1'),
        name: 'ProductConfiguration',
        hidden: false,
        meta: {
          title: 'NBConfiguration'
        }
      }
    ]
  },
  {
    path: '/DataTools',
    component: Layout,
    // redirect: '/CustomerProfile/CustomerProfile',
    // menuLevel: 1,
    meta: {title: 'DataTools', icon: 'icon-shujugongju'},
    children: [
      {
        path: 'StatusUpdate',
        component: statusUpdateFilter,
        name: 'StatusUpdate',
        hidden: false,
        meta: {
          title: 'StatusUpdate'
        }
      },
      {
        path: 'DataToolsFilterResult',
        component: _import('DataToolsFilterResult'),
        name: 'DataToolsFilterResult',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'DataToolsFilterResult',
          icon: 'icon-information'
        }
      },
    ]
  },
  {
    path: '/DataInfo',
    component: Layout,
    noFilter: true,
    meta: {title: 'DataInfo', icon: 'icon-drgspingtairuanjianxitong24', role: ['admin']},
    children: [
      {
        path: 'DataSource',
        component: _import('DataInfo/DataSource'),
        name: 'DataSource',
        noFilter: true,
        meta: {
          title: 'DataSource'
        }
      },
      {
        path: 'DataDictionary',
        // component: _import('Depthanalysis/DataDictionary'),
        component: _import('DataInfo/DataDictionary2'),
        name: 'DataDictionary',
        noFilter: true,
        meta: {
          title: 'DataDictionary'
        }
      }
    ]
  },
  {
    path: '/Reference',
    component: Layout,
    menuLevel: 2,
    noFilter: true,
    meta: {title: 'Reference', icon: 'icon-jibenziliao'},
    children: [
      {
        path: 'AboutUs',
        // component: _import('Introduction/AboutUs'),
        component: _import('Reference/newAboutUs'),
        name: 'AboutUs',
        noFilter: true,
        meta: {
          title: 'AboutUs'
        }
      },
      {
        path: 'FAQ',
        component: _import('Reference/faqInside1'),
        name: 'FAQ',
        noFilter: true,
        meta: {
          title: 'FAQ'
        }
      },
      {
        path: 'AIinCBI',
        component: _import('Reference/AIinCBI'),
        name: 'AIinCBI',
        noFilter: true,
        meta: {
          title: 'AIinCBI'
        }
      }
    ]
  },
  // { //api申请页面
  //   path: '/mySecretKey',
  //   component: Layout,
  //   menuLevel: 1,
  //   noFilter: true,
  //   meta: {title: 'mySecretKey', icon: 'icon-jibenziliao'},
  //   children: [
  //     {
  //       path: 'index',
  //       component: _import('CBIAPI/MySecretKey'),
  //       name: 'mySecretKey',
  //       noFilter: true,
  //       meta: {
  //         title: 'mySecretKey'
  //       }
  //     },
  //     {
  //       path: 'AccessProcess',
  //       component: _import('CBIAPI/AccessProcess'),
  //       name: 'AccessProcess',
  //       noFilter: true,
  //       meta: {
  //         title: 'AccessProcess'
  //       }
  //     }
  //   ]
  // },
  {path: '*', redirect: '/404', hidden: true}
]

export const outsideRouterMap = [
  {
    path: '/CBIAPI',
    component: Layoutoutside,
    redirect: '/CBIAPI/index',
    // hidden: true,
    menuLevel: 1,
    meta: {},
    children: [{
      path: 'index',
      // component: _import('CBIAPI/APIAccessProcess'),
      component: _import('CBIAPI/Example'),
      name: 'APIAccessProcess',
      meta: {
        title: 'APIAccessProcess',
        icon: 'icon-zonglan',
        noCache: true
      }
    }]
  },
  {
    path: '/CBIAPI',
    component: Layoutoutside,
    redirect: '/CBIAPI/index',
    hidden: true,
    menuLevel: 1,
    meta: {},
    children: [{
      path: 'index',
      // component: _import('CBIAPI/APIAccessProcess'),
      component: _import('CBIAPI/Example'),
      name: 'APIAccessProcess',
      meta: {
        title: 'APIAccessProcess',
        icon: 'icon-zonglan',
        noCache: true
      }
    }]
  },
  // {
  //   path: '/Example',
  //   component: Layoutoutside,
  //   hidden: false,
  //   menuLevel: 1,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('CBIAPI/Example'),
  //     name: 'Example',
  //     meta: {
  //       title: 'Example',
  //       icon: 'icon-yonghuming'
  //     }
  //   }
  //   ]
  // }
]
